/**
 * 
 */
package barney.davis.hume.it3048todo.dao;

import java.util.ArrayList;
import java.util.Calendar;

import barney.davis.hume.it3048todo.constants.TaskStatus;
import barney.davis.hume.it3048todo.dto.Task;

/**
 * @author Adam
 * 
 */
public interface ITaskDAO {

	/**
	 * Persists the supplied task to the database. This is a single method that
	 * handles new tasks (that are not in the database) as well as saving
	 * changes to existing tasks.
	 * 
	 * Tasks must have a due date.
	 * 
	 * @param task the task to be saved
	 * @throws Exception any problem with the persistence process
	 * @throws IllegalArgumentException cannot save a task without a due date.
	 */
	public void save(Task task) throws Exception;

	/**
	 * Returns the task for this ID.
	 * 
	 * @param ID of the task
	 * @return the task for the given ID.
	 * @throws Exception any data retrieval error
	 */
	public Task fetch(String ID) throws Exception;

	/**
	 * Returns a ArrayList<Task> of all tasks with the given status
	 * (OVERDUE, IN PROGRESS, COMPLETE, etc.)
	 * 
	 * @param TaskStatus status you are searching for
	 * @return ArrayList<Task> the list of tasks
	 * @throws Exception any data retrieval error
	 */
	public ArrayList<Task> fetchByStatus(TaskStatus status)
			throws Exception;

	/**
	 * Returns a ArrayList<Task> of all tasks with the given due date.
	 * All tasks due on this date, regardless of completion status or actual due
	 * time are returned.
	 * 
	 * @param Calendar date the date of the due date
	 * @return ArrayList<Task>  the list of tasks due that day
	 * @throws Exception any data retrieval error
	 */
	//public ArrayList<Task> fetchByDueDate(Calendar date) throws Exception;
	
	/**
	 * Returns an ArrayList<Task> of all dates between the first and last dates,
	 * inclusive.
	 * 
	 * @param firstDate The first date in the range of dates
	 * @param lastDate The last date in the range of dates
	 * @return The list of tasks due in the supplied date range
	 * @throws Exception any data retrieval error
	 */
	public ArrayList<Task> fetchByDueDate(Calendar firstDate, Calendar lastDate) throws Exception;

	/**
	 * Returns a ArrayList<Task> of all tasks
	 * 
	 * @return ArrayList<Task> all the tasks!
	 * @throws Exception any error in the retrieval process
	 */
	public ArrayList<Task> fetchAll() throws Exception;
	
	/**
	 * Deletes the supplied task.
	 * 
	 * @param task the task you wish to delete.
	 * @throws Exception any errors in the delete process.
	 */
	public void delete(Task task) throws Exception;
}
